<?php
/**
 * View_Interface_Info
 *
 * Класс View_Interface_Info отвечает за вывод информации, связанной с информационной составляющей интерфейса
 *
 * @author Дмитрий Кузьма <kouzma.d@gmail.com>
 * @version 1.0
 */
class View_Interface_Info extends View_Base {


	/**
	 * Выводит главное меню
	 *
	 */
	public static function showMainMenu() {
		echo '<div class="navbar navbar-default>';
			echo '<div class="container">';
				echo '<ul class="nav navbar-nav">';
					echo '<li><a href="'  . W_ABSPATH . '">' . Service_Translate::getText('Деревня') . '</a></li>'; //  class="active"
					//echo '<li><a href="#">' . Service_Translate::getText('Деревня2') . '</a></li>';
					//echo '<li><a href="#">' . Service_Translate::getText('Карта') . '</a></li>';
					//echo '<li><a href="#">' . Service_Translate::getText('Статистика') . '</a></li>';
					//echo '<li><a href="#">' . Service_Translate::getText('Отчеты') . '</a></li>';
					//echo '<li><a href="#">' . Service_Translate::getText('Сообщения') . '</a></li>';
					echo '<li><a href="'  . W_ABSPATH . 'send_troops/">' . Service_Translate::getText('Отправка войск') . '</a></li>';
					echo '<li><a href="'  . W_ABSPATH . 'send_traders/">' . Service_Translate::getText('Отправка торговцев') . '</a></li>';
				echo '</ul>';
			echo '</div>';
		echo '</div>';
	}
	
	/**
	 * Выводит ресурсы места
	 *
	 */
	public static function showPlaceResources() {
		$objGeneral = Game_General::instance();
		$arrProductionData = $objGeneral->objPlace->objResourcesWithProduction->getProductionData();
		$arrConsumptionStaticData = $objGeneral->objPlace->objResourcesWithProduction->getConsumptionStaticData();
		$arrCapacityData = $objGeneral->objPlace->objResourcesWithProduction->getCapacityData();
		echo '<div class="panel panel-default">';
  		echo '<div class="panel-body">';
				foreach ($objGeneral->objPlace->objResourcesWithProduction->getResourcesData() as $resourceId => $resourceValue) {
					$gameSourceName = Game_Resource::getResourceName($resourceId);
					echo '<img src="' . W_IMAGES . 'dot.gif" alt="' . $gameSourceName . '" class="r_' . $resourceId . '" />';
					echo $resourceValue . ' (' . $arrCapacityData[$resourceId] . ') / ' . $arrProductionData[$resourceId];
					echo  (isset($arrConsumptionStaticData[$resourceId]) ? (' / ' . $arrConsumptionStaticData[$resourceId]) : null);
					echo '<br/>';
				}
			echo '</div>';
		echo '</div>';
	}
	

	/**
	 * Выводит события данного пользователя
	 *
	 */
	public static function showUserEvents() {
		$objGeneral = Game_General::instance();
		$arrEvents = $objGeneral->objUser->getEventsData();
		$placeId = $objGeneral->objPlace->id;
		echo '<div class="panel panel-default">';
			echo '<div class="panel-body">';
				echo '<h3>' . Service_Translate::getText('События') . '</h3>';
				foreach ($arrEvents as $arrEvent) {
					if ($arrEvent['ID_place'] != $placeId) continue;
					switch ($arrEvent['event_type']) {
						case 'building':
							View_Special_Building::showBuildingEvent($arrEvent);
							break;
						case 'units_move':
							View_Special_UnitsMove::showMoveEvent($arrEvent);
							break;
						case 'trade':
							View_Special_Traders::showMoveEvent($arrEvent);
							break;
						case 'unit':
							View_Special_Troops::showCreatingEvent($arrEvent);
							break;
						case 'research':
							View_Special_Troops::showResearchEvent($arrEvent);
							break;
					}
				}
			echo '</div>';
		echo '</div>';
	}
	
	
	/**
	 * Выводит информацию о текущей деревне
	 * 
	 */
	public static function showOwnPlaceInfo() {
		$objGeneral = Game_General::instance();
		$objPalce = $objGeneral->objPlace;
		$objCoordinates = $objPalce->objCoordinates;
		$arrCoordinates = $objCoordinates->getCoordinatesData();
		echo '<div class="panel panel-default">';
		echo '<div class="panel-body">';
			echo '<b>' . Service_Translate::getText('Координаты места') . ': </b>';
			foreach ($arrCoordinates as $key => $coordinate) {
				if ($key > 1) echo ' | ';
				echo $coordinate;
			}
		echo '</div>';
		echo '</div>';
	}
	
	/**
	 * Выводит Главное меню
	 *
	 */
	/*
	public static function showMainMenu() {
		echo '<a href="' . W_ABSPATH . '">' . Service_Translate::getText('Главная') . '</a>';
		echo '<br/>===<br/>';
	}*/
}
?>